--
-- Craft rope block with strings or ropes
--  and craft ropes with vines
--

local modname = minetest.get_current_modname()
-- local modpath = minetest.get_modpath(modname)

-- Load support for MT game translation.
local S = minetest.get_translator(modname)


-- Items
local vines_rope_name = "vines:rope_block"
local xdecor_rope_name = "xdecor:rope"
local vines_rope = minetest.registered_items[vines_rope_name]
local xdecor_rope = minetest.registered_items[xdecor_rope_name]

-- local mod_mobs = minetest.get_modpath('xdecor')
-- local mod_vines = minetest.get_modpath('vines')

if vines_rope then

    if xdecor_rope then
    
      minetest.clear_craft({output = vines_rope_name})
      minetest.register_craft({
          output = vines_rope_name,
          recipe = {
              { 'group:wood' },
              { xdecor_rope_name },
              { xdecor_rope_name }
            }
          })
      minetest.register_craft( {
          output = xdecor_rope_name..' 2',
          recipe = {
              { 'group:vines' },
              { 'group:vines' },
              { 'group:vines' }
            }
          })
    
    elseif minetest.registered_items['farming:string'] then
    
      minetest.register_craft( {
          output = vines_rope_name,
          recipe = {
              { 'group:wood' },
              { 'farming:string 2' },
              { 'farming:string 2' }
            }
          })
    
    end
end


